from common import PlaceResult


class Output:
    # 打印提示攻击信息
    @staticmethod
    def print_alert_attack(player):
        print(player.get_name(), 'it is your turn !')

    # 打印地图
    @staticmethod
    def print_board(board):
        print(board.display())

    # 输出击中
    @staticmethod
    def show_hit():
        print('That is a Hit !, good shot')

    # 需要输出当前被sunk的船的名字
    @staticmethod
    def show_sunk(ship):
        Output.show_hit()
        print('You sunk my %s!' % ship.get_name())

    # 打印游戏结束
    @staticmethod
    def print_game_over(ship):
        Output.show_sunk(ship)
        print('You win!')

    # 打印摆放错误
    @staticmethod
    def print_place_error(place_result):
        if place_result == PlaceResult.OFF_BORDER:
            print('Ship not placed , that location places the ship outside of the game board')
            return
        print('Ship not placed , that location overlaps with another ship')

    # 输出字符串
    @staticmethod
    def print_str(string):
        print(string)
